package thread;

public class SyncDemo3 {
    public static void main(String[] args) {
        Thread t = new Thread(){
            public void run(){
                Boo.doSome();
            }
        };

        Thread t1 = new Thread(){
            public void run(){
                Boo.doSome();
            }
        };
        t.start();
        t1.start();

    }
}
class Boo{
    //public synchronized static void doSome() {
        public static void doSome(){
            synchronized (Boo.class) {
                try {
                    Thread t = Thread.currentThread();
                    System.out.println(t.getName() + "执行方法");
                    Thread.sleep(3000);
                    System.out.println(t.getName() + "执行完毕");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
